<?xml version="1.0" encoding="UTF-8" ?>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<title>合班</title>
	<%
    	String path = request.getContextPath();
	    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path;
    %>
	<c:set var="path" value="<%=basePath %>"></c:set>
 	<link href="${path }/css/bootstrap/bootstrap.min.css" rel="stylesheet" />
 	<link href="${path }/css/form-public.css" rel="stylesheet" />
 	<link rel="stylesheet" type="text/css" href="${path }/js/zeroModal/zeroModal.css" />
 	<link rel="stylesheet" href="./layui/css/layui.css"  media="all">
</head>
<body>
<form class="layui-form layui-form-pane" action="addclasshb" method="post">
  <div style="padding-top: 50px;padding-left: 300px">
  	  <div style="margin-left: 150px;padding-bottom: 10px;color:red">
  	  	<h2>班级合并</h2>
  	  </div>
  	  <div class="layui-form-item">
	    <label class="layui-form-label">班级名称</label>
	    <div class="layui-input-block">
	      <input type="text" style="width: 250px" id="clazz_name" name="clazz_name" autocomplete="off" placeholder="请输入新的班级名称" lay-verify="required" class="layui-input">
	    </div>
	  </div>
	  <div class="layui-form-item">
	  	<label class="layui-form-label">第一个班级</label>
		  <div class="layui-input-inline" style="width: 250px">
			<select id="class1" name="class1" lay-verify='required' lay-search=''>
			</select>  
		  </div>
	  </div>
	  <div class="layui-form-item">
	  <label class="layui-form-label">第二个班级</label>
		  <div class="layui-input-inline" style="width: 250px">
			<select id="class2" name="class2" lay-verify='required' lay-search=''>
			</select>  
		  </div>
	  </div>
	  <div class="layui-form-item">
	  <label class="layui-form-label">专业</label>
		  <div class="layui-input-inline" style="width: 250px">
			<select id="specialty" name="specialty" lay-verify='required' lay-search=''>
			</select>  
		  </div>
	  </div>
	  <div class="layui-form-item">
	  	<label class="layui-form-label">带班老师</label>
		  <div class="layui-input-inline" style="width: 250px">
			<select id="teacher" name="teacher" lay-verify='required' lay-search=''>
			</select>  
		  </div>
	  </div>
	  <div class="layui-form-item">
	    <div class="layui-input-block">
	      <button class="layui-btn" lay-submit="" lay-filter="demo1">立即提交</button>
	      <button type="reset" onclick="goclass()" class="layui-btn layui-btn-primary">返回</button>
	    </div>
	  </div>
  </div>
</form>

<script type="text/javascript" src="./js/jquery-3.1.1.js"></script>
<script type="text/javascript" src="./js/jqueryui/jquery-ui.js"></script>
<script src="./layui/layui.js" charset="utf-8"></script>    
	
<script>
/* $(function(){
	gettecher();
}); */
function goclass(){
	
}
layui.use(['form', 'layedit', 'laydate'], function(){
	var form = layui.form;
		$.ajax({
			url:'gethb',
			datatype:'json',
			success:function(data){
				var array1=data.list;
				var array2=data.teacher;
				var array3=data.classInfo;
				console.log(array3);
				var str="<option value=''>请选择专业</option>";
				for (var i = 0; i < array1.length; i++) {
					str+="<option value="+array1[i].specialty_id+">"+array1[i].specialty_name+"</option>";
				}
				$("#specialty").append(str);
				var str1="<option value=''>请选择老师</option>";
				for (var i = 0; i < array2.length; i++) {
					str1+="<option value="+array2[i].user_id+">"+array2[i].user_name+"</option>";
				}
				$("#teacher").append(str1);
				
				var str2="<option value=''>请选择第一个班级</option>";
				for (var i = 0; i < array3.length; i++) {
					str2+="<option value="+array3[i].clazz_id+">"+array3[i].clazz_name+"</option>";
				}
				var str3="<option value=''>请选择第二个班级</option>";
				for (var i = 0; i < array3.length; i++) {
					str3+="<option value="+array3[i].clazz_id+">"+array3[i].clazz_name+"</option>";
				}
				$("#class1").append(str2);
				$("#class2").append(str2);
				form.render('select');
			} 
		});
	
});
</script>
</body>
</html>